import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ManagerConfigVO, ManagerConfigForm, ManagerConfigQuery } from '@/api/device/managerConfig/types';

/**
 * 查询场地分润配置列表
 * @param query
 * @returns {*}
 */

export const listManagerConfig = (query?: ManagerConfigQuery): AxiosPromise<ManagerConfigVO[]> => {
  return request({
    url: '/device/managerConfig/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询场地分润配置详细
 * @param managerConfigId
 */
export const getManagerConfig = (managerConfigId: string | number): AxiosPromise<ManagerConfigVO> => {
  return request({
    url: '/device/managerConfig/' + managerConfigId,
    method: 'get'
  });
};

/**
 * 新增场地分润配置
 * @param data
 */
export const addManagerConfig = (data: ManagerConfigForm) => {
  return request({
    url: '/device/managerConfig',
    method: 'post',
    data: data
  });
};

/**
 * 修改场地分润配置
 * @param data
 */
export const updateManagerConfig = (data: ManagerConfigForm) => {
  return request({
    url: '/device/managerConfig',
    method: 'put',
    data: data
  });
};

/**
 * 删除场地分润配置
 * @param managerConfigId
 */
export const delManagerConfig = (managerConfigId: string | number | Array<string | number>) => {
  return request({
    url: '/device/managerConfig/' + managerConfigId,
    method: 'delete'
  });
};
